#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 2e5 + 5;

int n, k;
ll a[N];
struct Node {
  ll val, dep;
  bool operator<(Node o) const {
    if (val != o.val) return val > o.val;
    return dep > o.dep;
  }
};
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> k;
  rep(i, 1, n) cin >> a[i];
  int t = (n - 1 + (k - 2)) / (k - 1);
  n = t * (k - 1) + 1;
  priority_queue<Node> pq;
  rep(i, 1, n) { pq.push(Node{a[i], 0ll}); }
  ll sum = 0;
  rep(i, 1, t) {
    ll cur = 0;
    ll mxd = 0;
    rep(j, 1, k) {
      Node now = pq.top();
      pq.pop();
      cur += now.val;
      mxd = max(mxd, 1 + now.dep);
    }
    sum += cur;
    pq.push(Node{cur, mxd});
  }
  cout << sum << endl;
  cout << pq.top().dep;
  return 0;
}